<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: ActiveSupport::Cache::MemoryStore</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">ActiveSupport::Cache::MemoryStore</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../files/vendor/rails/activesupport/lib/active_support/cache/memory_store_rb.html">
                vendor/rails/activesupport/lib/active_support/cache/memory_store.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="Store.html">
                Store
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
A cache store implementation which stores everything into memory in the
same process. If you&#8216;re running multiple Ruby on <a
href="../../Rails.html">Rails</a> server processes (which is the case if
you&#8216;re using mongrel_cluster or Phusion Passenger), then this means
that your <a href="../../Rails.html">Rails</a> server process instances
won&#8216;t be able to share cache data with each other. If your
application never performs manual cache item expiry (e.g. when you&#8216;re
using generational cache keys), then using <a
href="MemoryStore.html">MemoryStore</a> is ok. Otherwise, consider
carefully whether you should be using this cache store.
</p>
<p>
<a href="MemoryStore.html">MemoryStore</a> is not only able to store
strings, but also arbitrary Ruby objects.
</p>
<p>
<a href="MemoryStore.html">MemoryStore</a> is not thread-safe. Use <a
href="SynchronizedMemoryStore.html">SynchronizedMemoryStore</a> instead if
you need thread-safety.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000328">clear</a>&nbsp;&nbsp;
      <a href="#M000325">delete</a>&nbsp;&nbsp;
      <a href="#M000326">delete_matched</a>&nbsp;&nbsp;
      <a href="#M000327">exist?</a>&nbsp;&nbsp;
      <a href="#M000322">new</a>&nbsp;&nbsp;
      <a href="#M000323">read</a>&nbsp;&nbsp;
      <a href="#M000324">write</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000322" class="method-detail">
        <a name="M000322"></a>

        <div class="method-heading">
          <a href="#M000322" class="method-signature">
          <span class="method-name">new</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000322-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000322-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/cache/memory_store.rb, line 18</span>
18:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
19:         <span class="ruby-ivar">@data</span> = {}
20:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000328" class="method-detail">
        <a name="M000328"></a>

        <div class="method-heading">
          <a href="#M000328" class="method-signature">
          <span class="method-name">clear</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000328-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000328-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/cache/memory_store.rb, line 47</span>
47:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">clear</span>
48:         <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">clear</span>
49:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000325" class="method-detail">
        <a name="M000325"></a>

        <div class="method-heading">
          <a href="#M000325" class="method-signature">
          <span class="method-name">delete</span><span class="method-args">(name, options = nil)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000325-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000325-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/cache/memory_store.rb, line 32</span>
32:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span> = <span class="ruby-keyword kw">nil</span>)
33:         <span class="ruby-keyword kw">super</span>
34:         <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-identifier">name</span>)
35:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000326" class="method-detail">
        <a name="M000326"></a>

        <div class="method-heading">
          <a href="#M000326" class="method-signature">
          <span class="method-name">delete_matched</span><span class="method-args">(matcher, options = nil)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000326-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000326-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/cache/memory_store.rb, line 37</span>
37:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete_matched</span>(<span class="ruby-identifier">matcher</span>, <span class="ruby-identifier">options</span> = <span class="ruby-keyword kw">nil</span>)
38:         <span class="ruby-keyword kw">super</span>
39:         <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">delete_if</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">=~</span> <span class="ruby-identifier">matcher</span> }
40:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000327" class="method-detail">
        <a name="M000327"></a>

        <div class="method-heading">
          <a href="#M000327" class="method-signature">
          <span class="method-name">exist?</span><span class="method-args">(name,options = nil)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000327-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000327-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/cache/memory_store.rb, line 42</span>
42:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">exist?</span>(<span class="ruby-identifier">name</span>,<span class="ruby-identifier">options</span> = <span class="ruby-keyword kw">nil</span>)
43:         <span class="ruby-keyword kw">super</span>
44:         <span class="ruby-ivar">@data</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">name</span>)
45:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000323" class="method-detail">
        <a name="M000323"></a>

        <div class="method-heading">
          <a href="#M000323" class="method-signature">
          <span class="method-name">read</span><span class="method-args">(name, options = nil)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000323-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000323-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/cache/memory_store.rb, line 22</span>
22:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">read</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">options</span> = <span class="ruby-keyword kw">nil</span>)
23:         <span class="ruby-keyword kw">super</span>
24:         <span class="ruby-ivar">@data</span>[<span class="ruby-identifier">name</span>]
25:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000324" class="method-detail">
        <a name="M000324"></a>

        <div class="method-heading">
          <a href="#M000324" class="method-signature">
          <span class="method-name">write</span><span class="method-args">(name, value, options = nil)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000324-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000324-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/cache/memory_store.rb, line 27</span>
27:       <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">write</span>(<span class="ruby-identifier">name</span>, <span class="ruby-identifier">value</span>, <span class="ruby-identifier">options</span> = <span class="ruby-keyword kw">nil</span>)
28:         <span class="ruby-keyword kw">super</span>
29:         <span class="ruby-ivar">@data</span>[<span class="ruby-identifier">name</span>] = <span class="ruby-identifier">value</span>.<span class="ruby-identifier">freeze</span>
30:       <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>